package main

import "fmt"

func main() {
	var N, M, K int
	fmt.Scan(&N, &M, &K)

	matrix := make([][]int, N)
	for i := 0; i < N; i++ {
		matrix[i] = make([]int, M)
		for j := 0; j < M; j++ {
			fmt.Scan(&matrix[i][j])
		}
	}

	for i := 0; i < N; i++ {
		if K >= matrix[i][0] && K <= matrix[i][M-1] {
			if binarySearch(matrix[i], K) {
				fmt.Println("Yes")
				return
			}
		}
	}

	fmt.Println("No")
}

// binarySearch 二分查找
func binarySearch(arr []int, target int) bool {
	low, high := 0, len(arr)-1
	if arr[low] == target || arr[high] == target {
		return true
	}

	var mid int
	for low <= high {
		mid = (low + high) / 2
		if arr[mid] == target {
			return true
		}

		if target > arr[mid] {
			low = mid + 1
		} else {
			high = mid - 1
		}
	}

	return false
}
